//
//  CHJViewController.m
//  CHJVideoKit
//
//  Created by jxzjxz on 12/06/2017.
//  Copyright (c) 2017 jxzjxz. All rights reserved.
//

#import "CHJViewController.h"
#import "CHJCaptureManager.h"

@interface CHJViewController ()
{
    CHJCaptureManager *manaber;
}
@end

@implementation CHJViewController


- (void)viewDidLoad
{
    [super viewDidLoad];
    
    manaber = [[CHJCaptureManager alloc] init];
    manaber.previewFrame = CGRectMake(0, 0, 200, 200);
    [manaber setup];
    [self.view addSubview:[manaber getPreview]];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(100, 300, 50, 50);
    btn.backgroundColor = [UIColor redColor];
    [btn addTarget:self action:@selector(clickBlock) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)clickBlock
{
    UIImage *Img = [manaber getCaptureImage];
    NSLog(@"dddd");
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [manaber startPreview];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
